package com.whims.MemoryError.OutOfMemoryError;

import java.util.ArrayList;
import java.util.List;

/**
 * java堆内存溢出
 * vm options:-Xms20M -Xmx20M -XX:+HeapDumpOnOutOfMemoryError
 */
public class JavaHead {

    static class HeadObject{}


    public static  void main(String [] args){
        List<HeadObject> list = new ArrayList<HeadObject>();
        while (true){
            list.add(new HeadObject());
        }

    }

}
